﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BasicCMS.Data;
using BasicCMS.Services;

namespace BasicCMS.Core.Services.Impl
{
    [ComponentRegistry]
    public class AccountService:BaseService,IAccountService
    {
        public CheckAccountResult CheckAccount(string loginName, string password)
        {
            CheckAccountResult result = CheckAccountResult.Success;

            var row=UnitOfWork.Table("Account")
                .Where("LoginName=@LoginName")
                .Param("LoginName", loginName)
                .ToRow();
            if (row == null)
            {
                result = CheckAccountResult.LoginNameNotExist;
            }
            else if (row["Password"].ToString() != password)
            {
                result = CheckAccountResult.PasswordNotExist;
            }
            return result;
        }
    }
}